import * as API from '../axios';
import * as util from "@/common/util";

export default {

  //机柜广告-获取对象列表
  programsList: (params) => {
    return API.axiosGetAPI(`/manage/adverts/${params.pageNum}/${params.pageSize}`, params);
  },


  //获取广告详情
  getAdDetail: (id) => {
    return API.axiosGetAPI(`/manage/adverts/${id}`);
  },


  //广告组-获取全部
  getADsGroups: () => {
    return API.axiosGetAPI(`/manage/advert-groups/all`);
  },

  //广告组-新增
  addADsGroup: (params) => {
    return API.axiosPostAPI(`/manage/advert-groups`, params);
  },

  //广告组-编辑
  editADsGroup: (params) => {
    return API.axiosPutAPI(`/manage/advert-groups`, params);
  },

  //广告组-删除
  delADsGroup: (params) => {
    return API.axiosDeleteAPI(`/manage/advert-groups/${params.id}`);
  },

  //广告组-下拉选项
  optionADsGroup: () => {
    return API.axiosGetAPI(`/manage/advert-groups/option`);
  },

  //存储统计
  adsStore: () => {
    return API.axiosGetAPI(`/manage/adverts/storage/statistics`);
  },

  //更改分组-批量
  changeBatchs: (params) => {
    return API.axiosPutAPI(`/manage/adverts/group/batch`, params);
  },

  //广告单个删除
  deleteADs: (id) => {
    const headers = {
      'lang-key': 'delete'
    }
    return API.axiosDeleteAPI(`/manage/adverts/${id}`, '', headers);
  },

  //广告批量删除
  deleteADsBatch: (params) => {
    const headers = {
      'lang-key': 'Remove_batch'
    }
    return API.axiosDeleteAPI('/manage/adverts/batch', params, headers, '', 2);
  },

  //节目单-获取列表
  getPrograms: (params) => {
    return API.axiosGetAPI(`/manage/programs/${params.pageNum}/${params.pageSize}`, params);
  },

  //节目单-新增节目单
  addPrograms: (params) => {
    const headers = {
      'lang-key': 'branch_Create'
    }
    return API.axiosPostAPI(`/manage/programs`, params, headers);
  },

  //获取组内所有广告
  getAllAds: (params) => {
    return API.axiosGetAPI(`/manage/adverts/all`, params);
  },

  //获取带屏设备选项
  getEquipment: (params) => {
    return API.axiosGetAPI(`/manage/cabinets/player/${params.pageNum}/${params.pageSize}`, params);
  },


  //获取节目单详情
  getProgramsDetail: (id) => {
    return API.axiosGetAPI(`/manage/programs/${id}`);
  },

  //获取节目单关联的机柜
  getProgramsCabinet: (params) => {
    return API.axiosGetAPI(`/manage/programs/${params.id}/cabinet`, params);
  },

  //下发广告
  sentAds: (params) => {
    return API.axiosPostAPI(`/manage/programs/delivery`, params);
  },

  //编辑状态
  editState: (params) => {
    return API.axiosPutAPI(`/manage/adverts/state`, params);
  },

  //编辑广告-不修改图片/视频
  editADs: (params) => {
    const headers = {
      'lang-key': 'branch_Edit'
    }
    return API.axiosPutAPI('/manage/adverts', params, headers);
  },

  //编辑节目单
  editPrograms: (params) => {
    const headers = {
      'lang-key': 'branch_Edit'
    }
    return API.axiosPutAPI('/manage/programs', params, headers);
  },

  //删除节目单-单个
  deletePlay: (id) => {
    const headers = {
      'lang-key': 'delete'
    }
    return API.axiosDeleteAPI(`/manage/programs/${id}`,'', headers);
  },

  //删除节目单-批量
  batchDaletePlay: (params) => {
    const headers = {
      'lang-key': 'Remove_batch'
    }
    return API.axiosDeleteAPI('/manage/programs/batch', params, headers, '', 2);
  },


}